Add a test to check object properties
authorJohan Dahlin <johan@src.gnome.org>
Wed, 27 Jun 2007 01:27:18 +0000 (01:27 +0000)
committerJohan Dahlin <johan@src.gnome.org>
Wed, 27 Jun 2007 01:27:18 +0000 (01:27 +0000)
    * tests/buildertest.c (test_object_properties):
    Add a test to check object properties

svn path=/trunk/; revision=18253

ChangeLog
tests/buildertest.c

index d62764592fb3f0e78582fa60aebd5fcbbc4bda70..73a2c3b84532df9c6acb7c8f5f5dbbf9fd87262d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,11 +1,15 @@
 2007-06-26  Johan Dahlin  <jdahlin@async.com.br>
 
+       * tests/buildertest.c (test_object_properties): 
+       Add a test to check object properties
+
        * gtk/gtkbuilder.h (enum): 
        * gtk/gtkbuilderparser.c (end_element): 
        * tests/buildertest.c (test_parser): 
        Set an error if we encounter properties without values set
        (#451303, Philip Withnall)
-       
+       (test_object_properties): Add a test
+
        * demos/gtk-demo/builder.c (do_builder): Connect the
        destroy signal in the example instead of the ui file.
        Also set the screen and title of the window.
index 3367bdcd1fb80bdbd6cef19364fd1bf97c84e384..199ee376ad186d185b23d66de7f30a6b90db330c 100644 (file)
@@ -761,6 +761,41 @@ gboolean test_construct_only_property (void)
   return TRUE;
 }
 
+gboolean test_object_properties (void)
+{
+  GtkBuilder *builder;
+  const gchar buffer[] =
+    "<interface>"
+    "  <object class=\"GtkWindow\" id=\"window1\">"
+    "    <child>"
+    "      <object class=\"GtkVBox\" id=\"vbox\">"
+    "        <property name=\"border-width\">10</property>"
+    "        <child>"
+    "          <object class=\"GtkLabel\" id=\"label1\">"
+    "            <property name=\"mnemonic-widget\">spinbutton1</property>"
+    "          </object>"
+    "        </child>"
+    "        <child>"
+    "          <object class=\"GtkSpinButton\" id=\"spinbutton1\"/>"
+    "        </child>"
+    "      </object>"
+    "    </child>"
+    "  </object>"
+    "</interface>";
+  GObject *label, *spinbutton;
+  
+  builder = builder_new_from_string (buffer, -1, NULL);
+  label = gtk_builder_get_object (builder, "label1");
+  g_return_val_if_fail (label != NULL, FALSE);
+  spinbutton = gtk_builder_get_object (builder, "spinbutton1");
+  g_return_val_if_fail (spinbutton != NULL, FALSE);
+  g_return_val_if_fail (spinbutton == (GObject*)gtk_label_get_mnemonic_widget (GTK_LABEL (label)), FALSE);
+  
+  g_object_unref (builder);
+
+  return TRUE;
+}
+
 gboolean test_children (void)
 {
   GtkBuilder * builder;
@@ -1474,6 +1509,10 @@ main (int argc, char **argv)
   if (!test_child_properties ())
     g_error ("test_child_properties failed");
 
+  g_print ("Testing object properties\n");
+  if (!test_object_properties ())
+    g_error ("test_object_properties failed");
+
   g_print ("Testing notebook\n");
   if (!test_notebook ())
     g_error ("test_notebook failed");